# -*- coding: utf-8 -*-
"""
Created on Sat Aug 26 16:37:55 2023

@author: skunk69
"""

import json

chinese_name = u'儿童社交焦虑量表'
english_name = 'Social Anxiety Scale for Children'
abbreviation = 'SASC'
category = u'精神病学临床量表'

outline = u"""儿童社交焦虑量表（Social Anxiety Scale for Children, SASC）是由La Greca等于1988年编制，主要用于儿童社交焦虑症状的评估。"""

instruction = u"""请指出每句话对你的适用程度，在选项“从不是这样”、“有时这样”、“一直这样”中选择一项。"""

with open('SASC.txt','r',encoding='utf-8') as f:
    lines = f.readlines()
    f.close()

items = {}
for line in lines:
    key,value = line.strip().split('、',maxsplit=1)
    items[key] = value.strip()

reverse_items = []
scales = [u'害怕否定评价',u'社交回避及苦恼']
scales_items = [
    [1,2,5,6,8,10],
    [3,4,7,9],
    ]
factors = []
factors_scales = []
rating = [u'从不是这样',u'有时这样',u'一直这样']
score_rules = list(range(3))

contents = {
    'instruction':instruction,
    'items':items,
    'reverse_items':reverse_items,
    'scales':scales,
    'scales_items':scales_items,
    'factors':factors,
    'factors_scales':factors_scales,
    'rating':rating,
    'score_rules':score_rules       
    }

implementation = u"""《儿童社交焦虑量表》是一个自评量表。适用于学龄期儿童。"""

reliability = u"""SASC的Cronbach α系数为0.76，重测信度为0.67。"""
validity = u"""SASC的评分与修订的儿童外显性焦虑量表的评分高度相关（r=0.57）。低年级儿童得分高于高年级儿童。此外，合群儿童的评分显著低于不和群儿童的评分，（后者在社会测量学中被称为“被忽视”和“被拒绝”儿童）。"""
measurements = {'reliability':reliability,'validity':validity}

interpretation = u"""主要统计指标为各因子分和总分。总分越高，表明儿童的社交焦虑情绪越明显。"""

applications = u"""作为一个测量儿童社交困难的工具，SASC的效度已经得到了初步的数据支持，但在对SASC的用途作出最终判别之前，还要对该表进一步大量研究。"""

this_scale = {
    'chinese_name':chinese_name,
    'english_name':english_name,
    'abbreviation':abbreviation,
    'category':category,
    'outline':outline,
    'contents':contents,
    'implementation':implementation,
    'measurements':measurements,
    'interpretation':interpretation,
    'applications':applications    
    }

with open(abbreviation+'.json','w+',encoding='utf-8') as f:
    json.dump(this_scale,f,indent=2,ensure_ascii=False)